package com.beauty.dressing.module.common.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.ViewGroup;

import com.beauty.dressing.common.bean.Comment;
import com.beauty.dressing.common.bean.GroupNavigation;
import com.beauty.dressing.common.bean.Video;
import com.beauty.dressing.module.common.holder.CommentHolder;
import com.beauty.dressing.module.main.adapter.VideoInListAdapter;
import com.beauty.dressing.module.main.holder.GroupNavHolder;
import com.beauty.dressing.module.main.holder.VideoInListHolder;

/**
 * 类描述
 *
 * @author xutingz
 * @email：914603097@qq.com
 */
public class CommentAdapter extends CommonExpandWrapperAdapter {
    public static class ViewType {
        public static final int COMMENT_GROUP = 1;
        public static final int COMMENT_VIEW = 2;
    }

    public CommentAdapter(Context context) {
        super(context);
    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) {
        super.onBindViewHolder(viewHolder, position);
    }

    @Override
    public int getItemViewType(int position) {
        Object o = getItem(position);
        if (o instanceof CommonExpandWrapperAdapter.FixedViewInfo) {
            return ((CommonExpandWrapperAdapter.FixedViewInfo) o).viewType;
        } else
        if (o instanceof Comment){
            return ViewType.COMMENT_VIEW;
        } else if (o instanceof GroupNavigation){
            return ViewType.COMMENT_GROUP;
        }
        return super.getItemViewType(position);
    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
        if (isHeader(viewType) || isFooter(viewType)) {
            return super.onCreateViewHolder(viewGroup, viewType);
        } else if (viewType == ViewType.COMMENT_VIEW){
            return new CommentHolder(mContext,mLayoutInflater,viewGroup);
        } else if (viewType == ViewType.COMMENT_GROUP){
            return new GroupNavHolder(mContext,mLayoutInflater,viewGroup);
        }
        return null;
    }
}
